package someTestExcemple.tcp.bs_tcp;

import java.io.*;
import java.net.Socket;

public class ServerReaderRunnable implements Runnable{
    private Socket socket;

    public ServerReaderRunnable(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            //响应给客户端 -把内容写出去 所以是输出流
            OutputStream out = socket.getOutputStream();
            PrintStream ps = new PrintStream(out);
            ps.println("Http/1.1 200 ok");
            ps.println("Content-Type:text/html;charset=UTF-8");
            ps.println();//必须换行
            ps.println("<div style= color:red;font-size:120px;text-align:center>黑马程序员</div>");
            ps.close();
            socket.close();
        } catch (Exception  e) {
            throw new RuntimeException(e);
        }
    }

}
